//
//  MyHeaderView.m
//  HVScrollView
//
//  Created by Libo on 17/6/14.
//  Copyright © 2017年 iDress. All rights reserved.
//

#import "MyHeaderView.h"

@interface MyHeaderView()

@property (nonatomic ,strong)UITextField *search;
@end

@implementation MyHeaderView

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        self.button = [UIButton buttonWithType:UIButtonTypeCustom];
        self.button.frame = CGRectMake(0, 0, 60, 30);
        self.button.backgroundColor = [UIColor yellowColor];
        [self.button setTitle:@"点我" forState:UIControlStateNormal];
        [self.button setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
        //[self addSubview:self.button];
        [self addSubview: self.imageView];
        [self addSubview:self.search];
    }
    return self;
}

- (UITextField *)search{
    if (_search == nil) {
        _search = [[UITextField alloc]init];
        //_search.placeholder = @""
        _search.backgroundColor = [UIColor whiteColor];
        _search.frame = CGRectMake(0, 0, ZD_screenWidth -150, 40);
        
    }
    return _search;
}

- (UIImageView *)imageView{
    if (_imageView == nil) {
        _imageView = [[UIImageView alloc]init];
       // _imageView.frame = CGRectMake(0, 0, ZD_screenWidth-30, <#CGFloat height#>)
        _imageView.backgroundColor = [UIColor blueColor];
    }
    return _imageView;
}



- (void)layoutSubviews {
    [super layoutSubviews];
    self.button.center = CGPointMake(self.bounds.size.width*0.5, self.bounds.size.height*0.5);
    self.search.center = CGPointMake(self.bounds.size.width*0.5, self.bounds.size.height - 30);
    self.imageView.frame = CGRectMake(15, 10, ZD_screenWidth-30, self.bounds.size.height - 40);
}

@end
